Skip to content

fix(apple): keep the Expo dev menu closed when open launches a dev client - #5053

Merged
thymikee merged 3 commits into
callstack:mainfrom
imranbarbhuiya:fix/expo-dev-menu-overlay
Nov 25, 2026
Merged

thymikee merged 3 commits into
callstack:mainfrom
imranbarbhuiya:fix/expo-dev-menu-overlay

Conversation

@imranbarbhuiya

@imranbarbhuiya imranbarbhuiya commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #5003. Follows #5013.

The Expo dev menu opens over the app at launch and takes every tap, so fill typed into nothing and the hint blamed the app.

  • Launch: on an iOS simulator, open now adds disableAutoLaunch=1 next to url on the expo-development-client URL it builds for a detected dev client. Expo documents this parameter for every SDK (development workflows); it also turns off the app's saved show-at-launch setting. The per-launch __expo_disable_auto_launch=1 was rejected: SDK 57 lacks it, and so does the test app's 58.0.3 launcher.
  • Hint: formatReactNativeOverlayWarning names the open menu when the capture has a Runtime version: or SDK version: line plus Reload or Go home, text only. It says to press Close, and to add disableAutoLaunch=1 to a URL of your own. Android's snapshot -i drops the version line, so there the hint shows in the full snapshot.
  • Fill: an empty read-back now names an overlay.

Before / after

iPhone 17 Pro simulator (iOS 27.2), fresh install of the test app, Metro on 8081; Pixel 9 emulator (Android 16).

iOS $ open com.callstack.agentdevicelab --metro-port 8081 && snapshot -i
base: @e33 [text] "Runtime version: exposdk:58.0.0", @e51 [button] "Continue" (menu up)
head: app home, no menu

$ snapshot (menu open: iOS -i, Android full)
base: no hint
head: Hint: The Expo dev menu looks open. It takes every tap until it closes, so press its Close button first.

Validation

  • Head 99f80e004, check:affected --run --head, exactCommit: true: format, lint, typecheck, layering, fallow, native-dupes, build and vitest-related pass; check:command-docs passes.
  • 10 new unit tests, plus 1 Swift unit test run on the simulator; the hint fixtures are text from the captured iOS and Android trees.
  • 10 mutants on the trigger, the launch parameter and the fill hint each fail a test.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the fix. At ab5f32e the code looks right, but the live evidence is not complete yet: Not verified here: the before/after in the PR body shows one capture route on an iOS simulator, the nested-window runner shape is covered only by trimmed fixtures, and Android Expo dev menu detection is untested (it may go undetected there, which is no regression).

Could React Native overlay recognition stay in one place? react-native-overlay.ts already owns it through analyzeReactNativeOverlay and formatReactNativeOverlayWarning. If readExpoDevMenu lived there, and analyzeReactNativeOverlay reported the open menu (detected, primaryAction 'close-expo-dev-menu' in the existing union), then snapshot-state would pass its surface as modalSurface. The daemon handler would need no change, ExpoDevMenuDismissTarget and the dynamic import would go away, and screenshot --overlay-refs would see the menu too. That drops roughly 40 production lines and turns four call sites into one owner.

Not blocking, and fine to take or leave: (1) screenshot-overlay.ts:138 does not report the open menu, so after a failed dismiss-overlay the warning still points to screenshot --overlay-refs; the owner move above fixes that. (2) On the nested path in snapshot-state.ts:354, any container with an 'SDK version' label, a Close button beside it and a Reload button below is read as the menu, so requiring the menu's own window would let the window decide rather than the words. (3) snapshot.ts:274 rescans the nodes for the hint, so the hint and the [covered] marks come from two scans; carrying the detected overlay on SnapshotState would give one fact.

No conflicts are known. The two cancelled Body rules runs look superseded by body edits and the diff does not touch that route, so they are likely unrelated, but a fresh passing Body rules run is needed before merge.

@imranbarbhuiya
imranbarbhuiya force-pushed the fix/expo-dev-menu-overlay branch from ab5f32e to cf8049b Compare November 24, 2026 04:01
@imranbarbhuiya

Copy link
Copy Markdown
Contributor Author
  • Live evidence: Done at cf8049b; the body now shows base and head on both iOS capture routes and on Android.
  • One owner: Done in 8cd7a2a: readExpoDevMenu lives in react-native-overlay.ts, analyzeReactNativeOverlay reports the open menu (close-expo-dev-menu) ahead of LogBox, formatReactNativeOverlayWarning gives its hint, and snapshot-state passes it as modalSurface; the handler's own target type and the dynamic import are gone. It costs two startup modules: snapshot assembly now imports the overlay owner, so react-native-overlay.ts and its contracts vocabulary join the daemon's eager closure, in two APPROVED_CLOSURE_ADDITIONS rows marked pending your approval. The handler still changes (219018f): Android's -i tree drops the menu's header, so when -i shows nothing to dismiss the handler reads the full tree and takes only a dev-menu target from it, and after the tap it polls the full tree for up to 1.5 s because the sheet slides out.
  • (1) screenshot --overlay-refs: Done in 8cd7a2a: it follows from the move; a test pins the menu's Close ranking first.
  • (2) Nested path: Done in 8cd7a2a: the menu's own window decides. Every node with text in that window, apart from the containers holding the sheet, must lie in the sheet; checked against the real runner and Android trees, both now fixtures.
  • (3) One fact on SnapshotState: Left as is: after the move the hint and the [covered] marks come from the same reader in one owner over the same nodes, and on Android a fact computed at assembly could not see the header either, since the -i tree drops it.
  • Devices, at cf8049b against base: iPhone 17 Pro simulator, the simulator capture (snapshot -i) marks the form [covered] and fill is refused before dispatch, the runner capture (dismiss-overlay) closes the menu at its header Close, verified; Pixel 9 emulator, dismiss-overlay reads the full tree and closes the menu, verified. Base detects no overlay on either.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the update. The earlier concerns are addressed at cf8049b, and the PR is ready from the code side.

Not blocking: the full-tree fallback in https://github.com/callstack/agent-device/blob/cf8049b/packages/daemon/src/execution/handlers/react-native.ts#L93 runs whenever the interactive capture finds no primary action, so every react-native dismiss-overlay that finds nothing now does a second full capture, and a failed fallback capture returns an error where it used to return ok. Keeping the dev-menu header in the interactive capture, or limiting the fallback to the capture shape that drops it, would avoid that, and a failed fallback could count as "no dev menu". These can be taken or left.

The only check not passing is Body rules, which was cancelled rather than failed. It reads the PR body format and does not touch any route this diff changes, so it was likely superseded by body edits. No conflicts are known. Before merge, the maintainer needs to approve or reject the two closure-budget rows for react-native-overlay.ts and contracts/react-native-overlay.ts, and Body rules needs a fresh passing run.

Not verified here: the live device runs at cf8049b (iOS simulator snapshot -i and fill refusal, iOS runner dismiss-overlay, Android dismiss-overlay), which rest on the PR body transcript. Not verified here: that Android's -i capture drops the menu header, so the need for the fallback over a smaller capture fix is open. Not verified here: whether the new nested-window and Android fixture tests fail at ab5f32e, or whether any real capture has the shape where the window equals the sheet in windowedExpoDevMenuSurface.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@imranbarbhuiya

Copy link
Copy Markdown
Contributor Author
  • Full-tree fallback: Done in 967d6a4: it now runs only on Android and only when the -i tree shows the menu's Close with a Reload or Go home below it and no version line, the shape Android's -i capture leaves; a fallback capture that fails counts as no dev menu and returns the old ok/no-overlay result. Tests pin the condition against the real Android -i capture, the iOS and no-controls cases that read no full tree, and the failed capture.
  • Keeping the header in Android's -i capture: Left as is: the filter that drops it (ui-hierarchy-inclusion.ts) would need an Expo-specific text keep, and the kept header alone is not enough, because the -i tree also drops the sheet that holds the header, Close and actions, so they come back as separate roots with no shared ancestor. Keeping the sheet as well would change the -i structure for every app.
  • Fixtures at ab5f32e: the runner-capture recognition tests pass there, since that shape already worked; the window-rule tests (2), the Android capture tests (2) and the Android handler tests (2) fail there, and so does the new sheet-under-root test.
  • Window equal to the sheet: no real capture has it (the runner capture and Android both put a window between the root and the sheet), so e5c12ce drops that case: a sheet right under the root is not read as a menu, with a test.
  • Devices, at 967d6a4 against base: iPhone 17 Pro simulator with the menu open, snapshot -i (the simulator capture) shows the hint and marks the form [covered], and dismiss-overlay (the runner capture, through the new window rule) closes the menu at its header Close, verified; Pixel 9 emulator with the menu open, dismiss-overlay reads the full tree and closes it, verified. With no menu, dismiss-overlay reports no overlay on both platforms, as base does; base detects no menu on either.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@thymikee

Copy link
Copy Markdown
Member

Thanks for the follow-up. At 967d6a4 the code looks good, and the open Expo dev menu is now handled on the iOS and Android routes this PR covers. The only check not passing is Body rules, and it was cancelled rather than failed; it reads the PR body format and none of the changed code is on its route, so a new run after a body edit should clear it. The other 15 checks pass at this head, and there are no conflicts. Before merge, a maintainer needs to approve or reject the two closure-budget rows for react-native-overlay.ts and contracts/react-native-overlay.ts, and Body rules needs a fresh passing run. Not verified here: any device run, since the live runs at 967d6a4 (iOS simulator snapshot -i and fill refusal, iOS runner dismiss-overlay, Android dismiss-overlay, and the no-menu case on both) rest on the PR body transcript and the author's comment. Not verified here: that the new tests fail at ab5f32e, which rests on the author's statement. Not verified here: whether the real Android -i capture always shows Reload or Go home below Close when the menu opens, for example with the sheet scrolled. If it does not, the menu stays undetected on that route, which matches the base behavior and is not a regression.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@thymikee

Copy link
Copy Markdown
Member

Thanks for the detailed captures. The recognizer is solid, but layout heuristics for a third-party UI across three capture shapes, plus two new startup modules, are a lot to keep green against future Expo releases. The evidence in #5003 is the menu at launch, so please try a smaller shape:

  1. Prevent it at launch: open already builds the expo-development-client URL for detected dev clients on iOS simulators (packages/platform-apple/src/expo-dev-client-launch.ts). Expo documents a disableAutoLaunch=1 parameter on that URL. Please confirm on a simulator that it keeps the menu closed at launch, and append it there.
  2. Hint instead of occlusion: add a dev menu branch to formatReactNativeOverlayWarning that triggers on the version line plus Reload/Go home text, with no layout checks. The hint tells the user to press Close, and to add disableAutoLaunch=1 (or turn off the menu's show-at-launch setting) when the URL is their own.
  3. Keep the empty read-back fill hint. It is generic and useful on its own.

That should drop the snapshot-state.ts import and the two closure rows. If the menu still shows up mid-session in real runs after this, [covered] can be revisited with that data.

@imranbarbhuiya
imranbarbhuiya force-pushed the fix/expo-dev-menu-overlay branch from 967d6a4 to 99f80e0 Compare November 24, 2026 16:06
@imranbarbhuiya imranbarbhuiya changed the title fix(capture-kit): treat the open Expo dev menu as covering the app fix(apple): keep the Expo dev menu closed when open launches a dev client Nov 24, 2026
@imranbarbhuiya

Copy link
Copy Markdown
Contributor Author
  • Smaller shape: Done, rebased on main as 67fb2d8 (fill hint), d72dada (launch) and 99f80e0 (hint). The occlusion and modalSurface path, the window and sheet rules, the snapshot-state.ts import, both closure rows and the dismiss-overlay dev-menu targeting with its Android full-tree read are gone; your hint says to press Close, so dismiss-overlay stays LogBox and RedBox only.
    1. Prevent it at launch: Done in d72dada: open appends disableAutoLaunch=1 next to url on the one expo-development-client URL it builds, with the server URL still encoded as url. Expo documents it for every SDK and notes that it also saves the app's show-at-launch setting (https://docs.expo.dev/develop/development-builds/development-workflows/); the per-launch __expo_disable_auto_launch=1 is not handled by SDK 57 or the test app's 58.0.3 launcher. On the iPhone 17 Pro simulator after a fresh install, base open --metro-port 8081 showed the menu with its onboarding, and head showed the app with the menu closed.
    1. Hint instead of occlusion: Done in 99f80e0: formatReactNativeOverlayWarning names the menu on a Runtime version: or SDK version: line plus Reload or Go home, text only, and says to press Close and to add disableAutoLaunch=1 (or turn off show-at-launch) to a URL of your own. It fires on the iOS simulator's snapshot -i and on Android's full snapshot; Android's snapshot -i drops the version line, so it stays quiet there. Both checked on devices.
    1. Empty read-back fill hint: Kept as 67fb2d8.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@thymikee

Copy link
Copy Markdown
Member

Thanks for the update. The code at 99f80e0 has no problems, and it keeps the earlier clean result from 967d6a4. The only check that is not passing is Body rules, which was cancelled and did not fail. It reads the PR body format and does not run any code touched here, and the body now has Summary, Before/after and Validation sections. The other 15 checks pass at this head. No conflicts are known. A fresh passing Body rules run is needed before merge, and a re-run should be enough. Not verified here: the simulator before/after (menu closed with disableAutoLaunch=1 on iPhone 17 Pro, SDK 58.0.3) and the Android/iOS hint captures rest on the PR body and the author comment, and no device was driven. Not verified here: SDK 57 behaviour rests on the Expo docs, not on a run. Not verified here: the Swift unit test and the vitest suites were not run, and the saved show-at-launch setting was not observed, so its effect on an app is taken from the Expo docs and the help text.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@thymikee
thymikee merged commit f1c5f3d into callstack:main Nov 25, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Expo dev menu is not treated as covering the app, so fill taps through it

2 participants